//
//  Character.h
//
//  Created by Scott Guyer on 3/21/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

typedef enum {
	kPilotAttrTypeIntel = 0,
	kPilotAttrTypeMemory,
	kPilotAttrTypeCharisma,
	kPilotAttrTypePerception,
	kPilotAttrTypeWillpower,
	kPilotAttrTypeCount
} PilotAttrType;


@interface Character : NSObject {

	// Core character data
	NSString*    userID;
	NSString*    apiKey;
	NSString*    charID;
	NSString*    name;
	NSString*    corporationName;
	NSString*    iskies;
	NSString*    race;
	NSString*    bloodline;
	NSString*    gender;
	
	// Attributes
	NSInteger	   _attributes[kPilotAttrTypeCount];
	NSInteger	   _implants[kPilotAttrTypeCount];
	float	       _effectiveAttributes[kPilotAttrTypeCount];
	NSInteger	   _basicSkillLevel[kPilotAttrTypeCount];
	NSInteger	   _advSkillLevel[kPilotAttrTypeCount];
	Boolean        _recalcEffectiveAttributes;	
	NSInteger      _learningSkill;
	
	// Known skill data
	NSInteger             _skillPoints;	
	NSMutableDictionary*  _skillsDict;  // keyed by typeID
	
	// training skill data
	NSDictionary*         skillTrainingDict;

	Boolean        _needsReload;
	
	NSDate*        characterDataLastLoad;
	NSDate*        characterDataCachedUntil;
	NSDate*        trainingDataLastLoad;
	NSDate*        trainingDataCachedUntil;
	
}

@property(retain,nonatomic) NSString*       userID;
@property(retain,nonatomic) NSString*       apiKey;
@property(retain,nonatomic) NSString*       charID;
@property(retain,nonatomic) NSString*       name;
@property(retain,nonatomic) NSString*       corporationName;
@property(retain,nonatomic) NSString*       iskies;
@property(retain,nonatomic) NSString*       race;
@property(retain,nonatomic) NSString*       bloodline;
@property(retain,nonatomic) NSString*       gender;
@property(retain,nonatomic) NSMutableDictionary*   skills;
@property(nonatomic) NSInteger              skillPoints;
@property(assign,nonatomic) Boolean         needsReload;
@property(retain,nonatomic) NSDate*         characterDataLastLoad;
@property(retain,nonatomic) NSDate*         characterDataCachedUntil;
@property(retain,nonatomic) NSDate*         trainingDataLastLoad;
@property(retain,nonatomic) NSDate*         trainingDataCachedUntil;
@property(retain,nonatomic) NSDictionary*   skillTrainingDict;


+ (void) initialize ;
+ (NSString*) nameForAttribute:(PilotAttrType)att ;

- (NSString*) getDescription;

- (int) getAttribute:(PilotAttrType)attType;
- (void) setAttribute:(PilotAttrType)attType withValue:(NSInteger)value;

- (int) getImplantBonus:(PilotAttrType)attType;
- (void) setImplantBonus:(PilotAttrType)attType withValue:(NSInteger)value;

- (float) getEffectiveAttribute:(PilotAttrType)attType;

- (int) skillPointsPerHourWithPrimary:(PilotAttrType)pri andSecondary:(PilotAttrType)sec ;

+ (NSMutableArray*) loadPilots ;
+ (Boolean) savePilots:(NSArray*)pilots ;

- (Character*) updateCharacterDataFrom:(Character*)newC ;


@end
